package com.softstao.softstaolibrary.library.widget;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.softstao.softstaolibrary.R;

/**
 * Created by win7 on 2017/2/22.
 */
public class MarginDecoration3 extends RecyclerView.ItemDecoration {
    private int margin;

    public MarginDecoration3(Context context) {
        margin = context.getResources().getDimensionPixelSize(R.dimen.category_margin);
    }

    @Override
    public void getItemOffsets(
            Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.set(0, 0, 0, margin/2);
    }

    public int getMargin() {
        return margin;
    }

    public void setMargin(int margin) {
        this.margin = margin;
    }
}
